﻿@{
    ViewBag.Title = "字典列表";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
@model DataDictionaryQueryModel
<div class="row">
    <div class="panel panel-default">
        <div class="panel-body">
            <form class="form-inline" role="form" id="searchForm">
            @Html.Partial("UC_Button", ViewBag.ButtonList as List<Sys_Menu>)
            </form>
        </div>
    </div>
    <div class="panel panel-default">
        <div class="panel-body">
            <table id="flexigridData">
            </table>
        </div>
    </div>
</div>
@section Customer_Js{
    <script type="text/javascript">
        function flexiQuery() {
            $('#flexigridData').bootstrapTable('refresh');
        }

      
        function dataDictionaryAdd() {
            window.location.href = '@Url.Action("Add", "DataDictionary")';
            return false;
        }

        

        function dataDictionaryEdit() {
            var row = $('#flexigridData').bootstrapTable('getSelections');
            if (row == null || row.length == 0) {
                BootStrapUI_Core.alertError('请选择需要编辑的行');
            } else {
                window.location.href = '@Url.Action("Edit", "DataDictionary")?id=' + row[0].Id;
            }
            return false;
        }

        $(function () {
            $('#btnQuery').on('click', flexiQuery);
          
            $('#btnDataDictionaryAdd').on('click', dataDictionaryAdd);
            $('#btnDataDictionaryEdit').on('click', dataDictionaryEdit);

            btTable('#flexigridData', {
                url: '@Url.Action("AjaxIndex", "DataDictionary")',
                columns: [[
                    { field: 'rowscount', checkbox: true, width: 15 },
                    { field: 'Title', title: '名称', width: 100 },
                    { field: 'Code', title: 'Key值', width: 100 },
                    { field: 'Sort', title: '排序', width: 120 },
                    { field: 'CreateTime', title: '创建时间', width: 200 },
                ]]
            });
        })
    </script>
}
